package com.peanut.baby.model;

import com.google.gson.annotations.SerializedName;
import com.peanut.devlibrary.util.JsonUtils;
import com.tencent.mars.xlog.Log;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by anonymouslystudio on 2017/7/24.
 */

public class LiveMsgContent {
    private static final String TAG = LiveMsgContent.class.getSimpleName();
    @SerializedName("width")
    public int  width = 0;
    @SerializedName("height")
    public int  height = 0;
    @SerializedName("url")
    public String  url = "";
    @SerializedName("duration")
    public int  duration ;
    @SerializedName("text")
    public String  text = "";

    public LiveMsgContent(){

    }

    public LiveMsgContent(String jsonString){
        Log.d(TAG,"jsonString: "+jsonString);
        try {
            JSONObject obj = new JSONObject(jsonString);
            width = JsonUtils.JSONInter(obj,"width");
            height = JsonUtils.JSONInter(obj,"height");
            url = JsonUtils.JSONString(obj,"url");
            duration = JsonUtils.JSONInter(obj,"duration");
            text = JsonUtils.JSONString(obj,"text");
        } catch (JSONException e) {
            e.printStackTrace();
        } finally {

        }
    }
}
